﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using AnyOffice.Components;
using System.Reflection;
using AnyOffice.DAL;
using log4net;
namespace AnyOffice.general.mytable
{
    public partial class netdisk : System.Web.UI.UserControl
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
   
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = new SqlConnection(ConfigManager.ConnectionString);

                DataView defaultView = new KnowledgeDao().SelectAll(conn).DefaultView;
                UserCache cache = new UserCache();
                string str = "(Type = 1)";
                str = (((str + " OR ((Type = 2) AND (',' + PostDept LIKE '%," + cache.DeptId.ToString() + ",%'))") + " OR ((Type = 3) AND (',' + AccessUser LIKE '%," + cache.UserId + ",%'))") + " OR (',' + NewUser LIKE '%," + cache.UserId + ",%')") + " OR (',' + ManageUser LIKE '%," + cache.UserId + ",%')";
                defaultView.RowFilter = str;
                if (defaultView.Count > 0)
                {
                    this.rptNetdisk.DataSource = defaultView;
                    this.rptNetdisk.DataBind();
                }
                else
                {
                    this.litNetdisk.Text = "·暂无知识共享";
                }
                conn.Close();
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        }

    }
}